JUnit Interview Questions and Answers
Question: What CLASSPATH Settings Are Needed to Run JUnit?Answer: You run your JUnit tests from a command line, from an IDE, or from "ant", you must define your CLASSPATH settings correctly. Here is what recommended by the JUnit FAQ with some minor changes:To run your JUnit tests, you'll need the following elemements in your CLASSPATH: * The JUnit JAR file should be there. * Location of your JUnit test classes. * Location of classes to be tested. * JAR files of class libraries that are required by classes to be tested. If found NoClassDefFoundError in your test results, then something is missing from your CLASSPATH. If you are running your JUnit tests from a command line on a Windows system: set CLASSPATH=c:\A\junit-4.4.jar;c:\B\test_classes; c:\B\target_classes; If you are running your JUnit tests from a command line on a Unix (bash) system: export CLASSPATH=/A/junit-4.4.jar:/B/test_classes: /C/target_classes: |
Is it helpful?
Yes
No
Most helpful rated by users:
- Who Should Use JUnit?
- What is JUnit?
- How To Compile a JUnit Test Class?
- Why Do You Use JUnit to Test Your Code?
- How To Write a Simple JUnit Test Class?